package com.myworkspace.standard.web.controller;

import com.alibaba.fastjson.JSONArray;
import com.myworkspace.standard.web.service.IndexService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/admin/index")
public class AdminIndexAction {
    @Resource
    private IndexService indexService;

    @GetMapping("toIndex")
    public String toIndex(HttpServletRequest request) {
        request.setAttribute("fileList", new JSONArray());
//        request.set
        List<Map<String, Object>> fileList = indexService.getFileList();
        request.setAttribute("fileList",fileList);

        return "index";
    }
}
